package com.strato.rpc.hessian.v1_0_0;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.caucho.hessian.server.HessianSkeleton;
import com.strato.mvc.api.v1_0_0.control.AbstractHttpInvoker;
import com.strato.mvc.api.v1_0_0.control.PathVariableCollector;
import com.strato.mvc.api.v1_0_0.model.ModelAndView;
import com.strato.rpc.transport.http.v1_0_0.RpcInvoker;

public class HessianHttpInvoker extends AbstractHttpInvoker implements RpcInvoker{

	HessianSkeleton hessianSkeleton=null;
	
	public HessianHttpInvoker(Object object, Class<?> intf) {
		 hessianSkeleton=new HessianSkeleton(object,intf);
	}

	@Override
	public String getBundleName() {
		return "rpc";//TODO
	}


	@Override
	public void doInvoke(HttpServletRequest request, HttpServletResponse response, PathVariableCollector pvc,
			ModelAndView mav) throws Exception {
		hessianSkeleton.invoke(request.getInputStream(),response.getOutputStream());
	}

}
